package view;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingUtilities;

@SuppressWarnings("serial")
public class DebugScreen extends JPanel {

	protected JTextArea debugTrace;
	
	public DebugScreen() {
		debugTrace = new JTextArea();
		debugTrace.setEditable(false);
		
		this.setLayout(new BorderLayout());
		
		this.add(new JScrollPane(debugTrace), BorderLayout.CENTER);
	}
	
	private class Write implements Runnable {
		String s;
		
		public Write(String s)
		{
			this.s = s;
		}
		
		public void run()
		{
			debugTrace.append(s);
		}
	}
	
	public void write(String s)
	{
		SwingUtilities.invokeLater(new Write(s));
		
	}
	
	/*public synchronized void write(String s)
	{
		debugTrace.append(s);
	}*/

}
